<script setup lang="ts">
// 元组类型 infer
const arr: number[] = [1, 2, 3, 4, 5]
arr
// 元组类型 数组里固定几项，类型是固定 比如经纬度设计数组结构，数组里只有两项，都是数字类型
const arr2: [number, string, number] = [1, '2', 3]
arr2
type MyTuple = [number, string, boolean, null, undefined]
// 取索引 能获取类型
type Test1 = MyTuple[2] | MyTuple[0]
// 希望获取类型[boolean, null, undefined]
type Test2 = [MyTuple[2], MyTuple[3], MyTuple[4]]

type GetTupleType<T extends unknown[]> = T extends [
  infer A,
  infer B,
  ...infer C
]
  ? B
  : never
type AAA = GetTupleType<MyTuple>
</script>

<template>
  <div class="playground-page">
    <h1>playground</h1>
  </div>
</template>

<style scoped lang="scss"></style>
